/**
 * 
 */
package com.ntv.service.wishes;

import java.util.Date;
import java.util.List;

import com.ntv.domain.IWishes;
import com.ntv.domain.Wishes;
import com.ntv.persistent.PersistentException;
import com.ntv.persistent.wishes.IWishesDao;
import com.ntv.service.DomainException;

/**
 * @author vedamoorthi vairam
 * @since 11/01/2009
 * 
 */
public class WishesAppService implements IWishesAppService {

	private IWishesDao wishesDao;

	/**
	 * @param wishesDao
	 *            the wishesDao to set
	 */
	public void setWishesDao(IWishesDao wishesDao) {
		this.wishesDao = wishesDao;
	}

	public List<IWishes> getCurrentDayWishes() throws DomainException {
		try {
			return wishesDao.getCurrentDayWishes();
		} catch (PersistentException e) {
			throw new DomainException(e);
		}
	}

	public List<IWishes> getAllWishesByPublishDate(Date date)
			throws DomainException {
		try {
			return wishesDao.getAllWishesByPublishDate(date);
		} catch (PersistentException e) {
			throw new DomainException(e);
		}
	}

	public void saveWish(Wishes wishes) throws DomainException {
		try {
			wishesDao.saveWish(wishes);
		} catch (PersistentException e) {
			throw new DomainException(e);
		}
	}

	public List<IWishes> getWishesByDate(String date) throws DomainException {
		List<IWishes> wishList = null;
		try {
			wishList = wishesDao.getWishesByDate(date);
		} catch (PersistentException e) {
			throw new DomainException(e);
		}
		return wishList;
	}
}
